/*
 * MIDPHttpConnection.java
 *
 * Created on 2007/10/15 +0900
 *
 * $Revision: 33 $
 * $Date: 2008-07-27 15:31:44 +0000 (Sun, 27 Jul 2008) $
 */

package org.gikolet.framework.platform.midp.internal;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.microedition.io.Connector;

import org.gikolet.framework.io.http.HttpConnection;

/**
 * @author Tetsutaro (latest modification by $Author: tetsutaro.ss $)
 * @version $Revision: 33 $ $Date: 2008-07-27 15:31:44 +0000 (Sun, 27 Jul 2008) $
 */
public class MIDPHttpConnection implements HttpConnection {
    private String url;

    private javax.microedition.io.HttpConnection midpHttpConnection;

    protected MIDPHttpConnection(String url) throws IOException {
	this.midpHttpConnection = (javax.microedition.io.HttpConnection) Connector
		.open(url, Connector.READ_WRITE, true);
	this.url = url;
	this.midpHttpConnection.setRequestMethod(GET);
    }

    public String getURL() {
	return this.url;
    }

    public String getRequestMethod() {
	return this.midpHttpConnection.getRequestMethod();
    }

    public String getRequestProperty(String key) {
	return this.midpHttpConnection.getRequestProperty(key);
    }

    public void setRequestMethod(String method) throws IOException {
	this.midpHttpConnection.setRequestMethod(method);
    }

    public void setRequestProperty(String key, String value) throws IOException {
	this.midpHttpConnection.setRequestProperty(key, value);
    }

    public InputStream openInputStream() throws IOException {
	return this.midpHttpConnection.openInputStream();
    }

    public OutputStream openOutputStream() throws IOException {
	return this.midpHttpConnection.openOutputStream();
    }

    public long getDate() throws IOException {
	return this.midpHttpConnection.getDate();
    }

    public long getExpiration() throws IOException {
	return this.midpHttpConnection.getExpiration();
    }

    public String getHeaderField(String name) throws IOException {
	return this.midpHttpConnection.getHeaderField(name);
    }

    public long getLastModified() throws IOException {
	return this.midpHttpConnection.getLastModified();
    }

    public int getResponseCode() throws IOException {
	return this.midpHttpConnection.getResponseCode();
    }

    public String getResponseMessage() throws IOException {
	return this.midpHttpConnection.getResponseMessage();
    }

    public String getType() throws IOException {
	return this.midpHttpConnection.getType();
    }

    public String getEncoding() throws IOException {
	return this.midpHttpConnection.getEncoding();
    }

    public long getLength() throws IOException {
	return this.midpHttpConnection.getLength();
    }

    public void close() throws IOException {
	this.midpHttpConnection.close();
    }
}
